using UnityEngine;
using System.Collections;

public class Basic_Menu_Item : MonoBehaviour 
{
	
	GUIText menuItem;							//Menu text that the player will interact with					//NOTE: may change to a button
	int minimumSize, maximumSize;				//Minimum / Maximum size of the menu item used for resizing
	bool mouseIsOver = false;					//Determines if the mouse is over the menu item
	public string sceneToLoad;					//Public scene to load so that it can be changed at edit time
	
	// Use this for initialization
	void Start ()
	{
		menuItem = gameObject.guiText;			//Menu item				//NOTE: May end up becoming a button
		minimumSize = menuItem.fontSize;		//Get the size of the menu item
		maximumSize = minimumSize * 2;			//Set the maximum font size for resizing later
	}
	
	//Occurs when the mouse position is over the menu item
	void OnMouseOver()
	{
		mouseIsOver = true;
		menuItem.fontSize = maximumSize;		//Sets the font size bigger			//NOTE: May change if menu item changes
	}
	
	//Occurs when the mouse position is over the menu item and than exits
	void OnMouseExit()
	{
		mouseIsOver = false;
		menuItem.fontSize = minimumSize;		//Sets the font size smaller		//NOTE: May change if menu item changes
	}
	
	// Update is called once per frame
	void Update ()
	{
		if(Input.GetButtonDown("Fire1") && mouseIsOver)
		{
			if(sceneToLoad != null)
			{
				Application.LoadLevel(sceneToLoad);
			}
		}
	}
}
